// pages/qiandao/course_rusult/course_rusult.js
import {
    baseUrl,
    isHaveToken,
    isLogin,
    javaUrl
} from "../../../utils/util";
Page({

    /**
     * 页面的初始数据
     */
    data: {
        class_img: "",
        class_name: "",
        signInfo: {},
        pwd: "",
        phone: "",
        activeid:"",
        status:'',
        type:'',
        class_id:'',
        course_id:'',
        signup:{}
    },
    getCourseDetail() {
        var that = this
        // console.log("fid",that.data.signup.fid)
        // console.log("activeid",that.data.activeid)
        // console.log("classId",that.data.class_id)
        // console.log("courseId",that.data.course_id)
        console.log("getCourseDetail",`${javaUrl}/xxt/login/getSignInfo?phone=${that.data.phone}&pwd=${that.data.pwd}`)
        // /xxt/login/getSignInfo?phone=19854810175&pwd=zxcasd
        if (that.data.phone && that.data.pwd != "") {
            wx.request({
                url: `${javaUrl}/xxt/login/getSignInfo?phone=${that.data.phone}&pwd=${that.data.pwd}`,
                method: 'POST',
                data: {
                    activeid: that.data.activeid,
                    classId: that.data.class_id,
                    courseId: that.data.course_id,
                    fid:  that.data.signup.fid
                    // activeid: "8000048071918",
                    // classId: "59847534",
                    // courseId: "227018487",
                    // fid:  "851"
                },
                success(res) {
                    console.log("res", res)
                    that.setData({
                        signInfo: res.data.data.signInfo
                    })
                }
            })
        }else{
            console.log("e")
        }
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        console.log("options",options)
        console.log("pwd",wx.getStorageSync('pwd'))
        console.log("phone",wx.getStorageSync('phone'))
        this.setData({
            pwd: wx.getStorageSync('pwd'),
            phone: wx.getStorageSync('phone'),
            signup:wx.getStorageSync('signup'),
            class_img: options.class_img,
            class_name: options.class_name,
            activeid:options.activeid,
            status:options.status,
            type:options.type,
            class_id:options.class_id,
            course_id:options.course_id,
        })
        this.getCourseDetail()
    },


    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})